# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=consolekit2
pkgver=1.2.4
pkgrel=2
pkgdesc="Framework for defining and tracking users, login sessions, and seats"
provides="consolekit=$pkgver"
replaces="consolekit"
# s390x and riscv64 blocked by polkit
arch="all !s390x !riscv64"
url="https://consolekit2.github.io/ConsoleKit2"
license="GPL-2.0-or-later"
depends="
	eudev
	polkit
	"
makedepends="
	autoconf
	automake
	eudev-dev
	gettext-dev
	glib-dev
	libdrm-dev
	libnih-dev
	libtool
	libxslt-dev
	polkit-dev
	xorg-server-dev
	zlib-dev
	"
source="https://github.com/ConsoleKit2/ConsoleKit2/archive/$pkgver/ConsoleKit2-$pkgver.tar.gz
	0001-busybox-reboot-and-poweroff-support.patch
	pam-foreground-compat.ck
	"
subpackages="$pkgname-dev $pkgname-doc $pkgname-lang"
builddir="$srcdir/ConsoleKit2-$pkgver"
options="!check" #no testsuite provided

build() {
	NOCONFIGURE=1 ./autogen.sh
	./configure \
		--prefix=/usr \
		--sysconfdir=/etc \
		--localstatedir=/var \
		--disable-static
	sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
	make
}

package() {
	make DESTDIR="$pkgdir" install
	install -m 755 "$srcdir"/pam-foreground-compat.ck \
		"$pkgdir"/usr/lib/ConsoleKit/run-session.d/

	mkdir -p "$pkgdir"/usr/share/dbus-1/system.d/
	mv "$pkgdir"/etc/dbus-1/system.d/* "$pkgdir"/usr/share/dbus-1/system.d/
}
sha512sums="
ac92391d6b171158f55d9974b56bf5d81b9c6c1e8aa3961e9d0f77475e9b99fa2d291bfb243686288a9a060ff2d8cb96751310e55fdd4299f4c003eefc146ae8  ConsoleKit2-1.2.4.tar.gz
ec0c88e640afac0561c84131d63fa8c9e2e29611b789ae5c163cd11465b22017602d88dc853866624f57bce2ee466ab63af075d083a9ba6e87327ad8d0a0769f  0001-busybox-reboot-and-poweroff-support.patch
3b114fbbe74cfba0bfd4dad0eb1b85d08b4979a998980c1cbcd7f44b8a16b0ceca224680d4f4a1644cd24698f8817e5e8bdfcdc4ead87a122d0e323142f47910  pam-foreground-compat.ck
"
